﻿<!--#include file="../../Inc/Const.asp"-->
<%
Dim Plus
Set Plus = New Cls_Plus
Plus.Open("webftp") ' 打开配置文件
Plus.CheckUser ' 权限检查
If Plus.Config("state") = 0 Then Response.Write Plus.Lang("state") : Response.End
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>管理</title>
<link href="../../inc/Images/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../inc/Images/func.js"></script>
<style type="text/css">
<!--
.list { margin: 0px; padding: 0px; }
.list li { list-style-image: none; list-style-type: none; float: left; text-align: center; padding:15px 15px 10px 15px; }
.img { border: 1px solid #ECF7D9; padding: 20px; }
.img img { border: 0px; height:60px; width:60px; }
.txt { width: 100px; white-space:nowrap; text-overflow:ellipsis; overflow: hidden; padding-top: 5px; }
-->
</style>
</head>
<body>
<%
Dim Url,Urli,Urlr
Url = "_Manage.asp"
Urli = Request("urli")
Urlr = Request("urlr")
if len(Urli) = 0 then Urli = Plus.config("dir") & "/"&  Urli 
if len(Urlr) = 0 then Urlr = Plus.config("dir")
Urli = replace(Urli,"//","/")
Urlr = replace(Urlr,"//","/")

Dim ArrowEXT,Href
ArrowEXT = Plus.Config("ext")


If request("act") = "save" Then
	Dim SaveFile,SaveContent
	SaveFile = Request("file")
	SaveContent = Request("content")
	Call CreateFile(SaveContent,SaveFile)
End If 

Dim Fileurl
Fileurl =  replace(request("file"),"//","/")
%>
<table width=100% border=0 cellpadding=3 cellspacing=1 class=css_table bgcolor='#E1E1E1'>
	<tr class=css_menu>
		<td><table width=100% border=0 cellpadding=4 cellspacing=0 class=css_main_table>
				<form name=frmSearch method=post action=<%=Url%>>
					<tr>
						<td class=css_main><a href=<%=Url%>>WEbFTP</a>
							<a href=<%=Url%>?urli=<%=Urlr%>>BACK</a></td>
						<td class=css_search>&nbsp;</td>
					</tr>
				</form>
			</table></td>
	</tr>
	<tr>
		<td class='css_top'>URL: <%If Len(Fileurl) > 0 Then Response.write Fileurl Else Response.Write Urli%></td>
	</tr>
	<%
	Dim Root,F,Ext,Extarr,Extimg
	Set Root = Fso.GetFolder(Server.Mappath(Urli))
	%>
	<%If Len(Fileurl) > 0 Then%>
	<form id="form1" name="form1" method="post" action="<%=URL%>?act=save&file=<%=server.htmlencode(Fileurl)%>">
	<tr>
		<td class='css_list'>
			<textarea name="content" style="width:98.9%;height:440px;"><%=server.htmlencode(getfile(Fileurl))%></textarea>
			<input type="submit" name="button" id="button" value="保存&nbsp;&nbsp;(只支持<%=Response.Charset%>类型文件)" /></td>
	</tr>
	</form>
	<%End If%>
	<tr>
		<td class='css_list'><ul class='list'>
			<%
			For Each F In Root.SubFolders
				Response.write "<li><a href=?urli=" & server.urlencode(urli) & "/" & server.urlencode(F.name) & "&urlr=" & server.urlencode(Urli) & "><div class='img'><img src=images/folder.gif></div><div class='txt'>" & F.Name & "</div></a></li>"
			Next
			For Each F In Root.files
				Extarr = Split(F.Name,".")
				Ext = LCase(Extarr(Ubound(Extarr)))
				Href = "#"
				If Instr(LCase(ArrowEXT),LCase(Ext)) > 0 Then Href="?urli=" & server.urlencode(urli) & "&urlr="&server.urlencode(urli) & "&file=" & server.urlencode(urli) & "/" & server.urlencode(F.name)
				if Instr("/png/jsp/asa/bat/rm/mp3/pdf/wma/rmvb/asp/html/htm/shtm/shtml/php/css/js/txt/gif/jpeg/jpg/bmp/swf/mdb/doc/xls/rar/zip/exe/xml/xsl/vbs/","/" & Ext & "/") > 0 Then Extimg = Ext Else Extimg = "file"
				Response.write "<li><a href=" & href & " title=""NAME: " & F.Name & "; TYPE: " & F.Type & ";""><div class='img'><img src=images/" & Extimg & ".gif></div><div class='txt'>" & F.Name & "</div></a></li>"
			Next
			%></ul>
		</td>
	</tr>
	<%
	set Root = nothing
	%>
</table>
</body>
</html>
<%
Set Plus = Nothing
%>